 {include file="common/head_exit"}



<div>
  <textarea class="form-control" placeholder="写下想说的···"> </textarea>
  <div class="img_up">
    <img src="">
  </div>
  <div id="updata-text" style="margin-left: 3%;margin-right: 3%;">
            <span>上传图片</span>
            <input type="file" id="updata-head" accept="image/png,image/gif,image/jpg" name="head-image">
        </div>
</div>
<script type="text/javascript">
    $('#updata-head').change(function () {
        var input = $('#updata-head')[0].files[0];
        if (input == undefined || input.size <= 0) {
            alert('请选择图片')
            return;
        }
        var fromfile = new FormData();
        fromfile.append('file', input, input.value)
        data = fromfile
        $.ajax({
            url: '/meetTWO/public/index/Sign/updataImg',
            data: 'data',
            type: 'post',
            cache: false,
            processData: false,
            contents: false,
            contentType: false,
            success: function (res) {
                
                var  _data=JSON.parse(res)
                _data=JSON.parse(_data)
                var src='/meetTWO/public/static/picture/userHeadImg/'+_data.data+'/img.png?rand='+Math.random()
                $('img').attr('src',src)
                alert('上传成功')
            }, error: function () {
                alert('网络错误')
            }

        })

    })
</script>